<template>
  <div class="login_container">
    <div class="login_box">
      <div class="login_content">
        <div class="to_regist">
          <span class="to_regist_text">你还没有账号吗？</span>
          <el-button type="primary" size="small" @click="toregist">注册</el-button>
        </div>
        <div class="login_content_form">
          <div class="login_from_content">
            <p class="slogan">欢迎登陆我的博客</p>
            <el-form label-position="top"
                     label-width="80px"
                     :model="ruleForm"
                     :rules="rules"
                     ref="ruleForm">
              <el-form-item label="用户名" prop="username">
                <el-input v-model="ruleForm.username" placeholder="请输入用户名"></el-input>
              </el-form-item>
              <el-form-item label="密码" prop="password">
                <el-input v-model="ruleForm.password" placeholder="请输入密码"></el-input>
              </el-form-item>
              <div class="from_check_text">
                <el-checkbox v-model="checked">记住密码</el-checkbox>
                <el-link :underline="false" class="fogetpwd">忘记密码?</el-link>
              </div>
            </el-form>
            <el-button type="primary" class="login_btn" @click="submitForm('ruleForm')">登陆</el-button>
            <div class="other_login_apart">
              <p class="ohter_login_text">其他登陆方式</p><div class="line"/>
            </div>
            <div class="other_login_logo">
              <a href="#">
                <div class="login_logo" ><font-awesome-icon class="wechat" icon="fa-brands fa-weixin" /><span class="icon-text">微信</span></div>
              </a>
              <a href="#">
                <div class="login_logo"><font-awesome-icon  class="github"  icon="fa-brands fa-github-square" /><span class="icon-text">GitHub</span></div>
              </a>
              <a href="#">
                <div class="login_logo"><font-awesome-icon class="alipay" icon="fa-brands fa-alipay" /><span class="icon-text"  >支付宝</span></div>
              </a>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Login",
  data() {
    return {
      ruleForm: {
        username: 'admin',
        password: '',
      },
      rules:{
        username: [
          { required: true, message: '请输入用户名', trigger: 'blur' },
        ],
        password: [
          { required: true, message: '请输入密码', trigger: 'blur' }
        ]
      },
      checked:false,
    };
  },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          alert('submit!');
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    toregist(){
      this.$router.push('/regist')
    }
  }
}
</script>

<style scoped>
.login_container {
  height: 100vh;
  width: 100vw;
  background-image: linear-gradient(90deg, #3B73F0, #A5C1FF);
  display: flex;
  flex-direction: row-reverse;
}

.login_container .login_box {
  width: 50%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  /*background-color: pink;*/
}

.login_container .login_box .login_content {
  width: 600px;
  height: 600px;
  background-color: #fff;
  border-radius: 10px;
  position: relative;
}

.login_container .login_box .login_content .to_regist {
  width: 100%;
  height: 60px;
  display: flex;
  padding: 20px;
  justify-content: flex-end;
  align-items: center;

}

.login_container .login_box .login_content .to_regist .to_regist_text {
  font-size: 12px;
  color: #1F1D2B;
  margin-bottom: 0;
  margin-right: 10px;
}

.login_container .login_box .login_content .login_content_form {
  width: 100%;
  height: 540px;
  position: absolute;
  top: 60px;
  padding:  0 100px;
  display: flex;
  align-items: center;
}
.slogan
{
  text-align: center;
  font-size: 26px;
  color: #3B73F0;
  font-weight: bold;
}

.login_container .login_box .login_content .login_content_form .login_from_content
{
  width: 100%;
}

.from_check_text
{
  display: flex;
  justify-content: space-between;
}

.fogetpwd
{
  font-size: 12px;
  color: #9195A1;
  cursor: pointer;
}

.fogetpwd:hover
{
  color: #1F1D2B;
}

.login_btn
{
  margin-top: 22px;
  width: 100%;
  background-image: linear-gradient(90deg, #3B73F0, #A5C1FF);
}

.login_btn:hover
{
  opacity:0.8;
}

.other_login_apart
{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
}
.other_login_apart .other_login_apart
{
  display: inline-block;
}

.other_login_apart .line
{
  width: 70% ;
  height: 1px;
  background-color: #000000;
}

.other_login_apart .ohter_login_text
{
  font-size: 12px;
  color: #1F1D2B;
}

.other_login_logo
{
  margin-top: 22px;
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.other_login_logo .icon-text
{
  color:#1F1D2B ;
  margin-left:10px ;
}

.login_logo
{
  border: 1px solid black;
  height: 30px;
  width: 90px;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.wechat {
  color: #9cda62;
}
.github
{
  color: black;
}
.alipay
{
  color: #00A0E9;
}


</style>
